package com.doctcloud.hisinfo.histable.domain.medrec;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.doctcloud.common.core.annotation.Excel;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.util.Date;

import static com.doctcloud.common.core.utils.StringUtils.trim;

/**
 * @ClassName 患者住院主记录
 * @Author samula
 * @Descripe product by com.doctcloud
 * @Data 2025-09-23 1:21
 **/
//@TableName("pat_visit")
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(of = {"patientId", "visitId"})
@ToString
public class PatVisitDo implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 患者ID */
    @Excel(name = "患者ID")
    @NotBlank(message = "患者ID不能为空")
    private String  patientId;
    /** 住院标识 */
    @Excel(name = "住院标识号")
    @NotNull(message = "患者住院标识不能为空")
    @Positive(message = "患者住院标识必须大于0")
    private Integer visitId;
    /** 入院科室代码 */
    @Excel(name = "入院科室代码")
    private String deptAdmissionTo;
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "入院时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date admissionDateTime;
    /** 出院科室代码 */
    @Excel(name = "出院科室代码")
    private String deptDischargeFrom;
    /** 出院时间*/
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "出院时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date dischargeDateTime;
    /** 科主任 */
    @Excel(name = "科主任")
    private String director;
    /** 主治医师 */
    @Excel(name = "主治医师")
    private String attendingDoctor;
    /**经治医生*/
    @Excel(name="经治医师")
    private String doctorInCharge;
    /** 门诊医师 */
    @Excel(name = "门诊医师")
    private String consultingDoctor;
    /** 办理员 */
    @Excel(name = "办理入院人")
    private String admittedBy;
    @Excel(name = "出院方式")
    private String dischargeDisposition;

    @Data
    public static class primaryKey {
        private final String patientId;
        private final Integer visitId;
        public primaryKey(String patientId,Integer visitId) {
            this.patientId = patientId;
            this.visitId = visitId;
        }
    }

    public void setDirector(String director) { this.director = trim(director); }

    public void setAttendingDoctor(String attendingDoctor) {
        this.attendingDoctor = trim(attendingDoctor);
    }

    public void setDoctorInCharge(String doctorInCharge) {
        this.doctorInCharge = trim(doctorInCharge);
    }

    public void setConsultingDoctor(String consultingDoctor) { this.consultingDoctor = trim(consultingDoctor); }

    public void setAdmittedBy(String admittedBy) {
        this.admittedBy = trim(admittedBy);
    }

}
